package cn.le.producer;

import cn.le.vo.KafkaDownVO;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

import java.util.List;

import static cn.le.util.Constant.DOWN_TOPIC;

@Component
public class KafkaMapping {

    @Autowired
    private KafkaTemplate kafkaTemplate;

    public void send(KafkaDownVO downVO){
        String json = JSONObject.toJSONString(downVO);
        kafkaTemplate.send(DOWN_TOPIC,json);
    }

}
